<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition>
		<h:head>
	    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>Cristina Bittencourt Atelier</title>
			<meta name="keywords" content="wedding store, free web templates, free css templates" />
			<meta name="description" content="Wedding Store is a free web template for everyone. Download this template from templatemo.com" />
			<link rel="stylesheet" href="css/templatemo_style.css" type="text/css" />
			<script language="javascript" type="text/javascript">
			function clearText(field)
			{
			    if (field.defaultValue == field.value) field.value = '';
			    else if (field.value == '') field.value = field.defaultValue;
			}
			</script>
	
		 </h:head>	
		<div id="templatemo_wrapper_outter">
		
			<div id="templatemo_wrapper_inner">
		    
			   	<div id="templatemo_header">
					<ui:include src="header.xhtml"></ui:include>    
			   	</div> <!-- end of templatemo_header -->
		    
			    <div id="templatemo_menu">
			    	<ui:include src="menutop.xhtml"></ui:include>
			    </div> <!-- end of templatemo_menu -->
			    
			    <div id="templatemo_content_wrapper">
			    
			    	<div id="templatemo_sidebar_wrapper">
			    
			            <div id="templatemo_sidebar_top"></div>
			            <div id="templatemo_sidebar">
			            	<ui:include src="menuesquerdo.xhtml"></ui:include>
			            </div>
			            <div id="templatemo_sidebar_bottom"></div>
			        
			        </div>
			    	
					<div id="templatemo_content">
					    <p:outputPanel>
					    	<p:dataTable id="carrinho" 
					    	rowKey="#{produtoCarrinho.id}"
					    	value="#{carrinhoController.carrinho.produtos}"
					    	var="produtoCarrinho"
					    	selectionMode="single"
					    	emptyMessage="Não há produtos no carrinho">
						    	<p:column>
						    		<f:facet name="header"><h:outputText value="Nome " /></f:facet>
						    		<h:outputText value="#{produtoCarrinho.nome}" />
						    	</p:column>
						    	<p:column>
						    		<f:facet name="header"><h:outputText value="Preço" /></f:facet>
						    		<h:outputText value="#{produtoCarrinho.preco}" converter="br.com.projetosivan.converter.MoedaConverter"/>
						    	</p:column>
						    	<p:column>
								    <h:form> 
								    	<p:commandLink value="Remover" update="carrinho,valorTotal">
								        	<f:param name="id" value="#{produto.id}"></f:param>
								        	<p:collector value="#{produtoCarrinho}" 
								        		removeFrom="#{carrinhoController.carrinho.produtos}" ></p:collector>	
								        </p:commandLink>
								    </h:form>    
						    	</p:column>
					    	</p:dataTable>
					    	<h:outputText value="Valor Total: " />
					    	<h:outputText id="valorTotal" value="#{carrinhoController.valorTotal}" converter="br.com.projetosivan.converter.MoedaConverter"/>
					    </p:outputPanel>
					    <h:form>
					    	<p:commandButton value="Continuar Comprando" action="#{carrinhoController.continuarComprando}"></p:commandButton>
					   		<p:commandButton value="Finalizar Compra" action="#{carrinhoController.finalizarCompra}"></p:commandButton>
					    </h:form>
			        </div>
			        <div class="cleaner"></div>
			        
			    </div> <!-- end of templatemo_content_wrapper -->
			    
			    <div id="templatemo_footer">
					<ui:include src="footer.xhtml"></ui:include>
			    </div>
		    
		    </div> <!-- end of templatemo_wrapper_inner -->
		
		</div> <!-- end of templatemo_wrapper_outter -->
		
    </ui:composition>
</html>